package com.huntero.hweather.adapter;

import java.util.ArrayList;
import java.util.List;

import com.huntero.hweather.bean.CityCode;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class CountyAdapter extends BaseAdapter {

	private List<CityCode> mData=new ArrayList<CityCode>();
	private Context mContext;
	private LayoutInflater mInflater;
	
	public CountyAdapter(Context context,List<CityCode> data){
		this.mContext = context;
		this.mData = data;
		this.mInflater = LayoutInflater.from(context);
	}
	
	@Override
	public int getCount() {
		return this.mData.size();
	}

	@Override
	public Object getItem(int position) {
		if(this.mData == null || this.mData.size() <= position)
			return null;
		return this.mData.get(position);
	}

	@Override
	public long getItemId(int position) {
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		TextView tv = new TextView(this.mContext);
		tv.setText(mData.get(position).cnName);
		return tv;
	}

}
